// 数据模型
// 操作数据库里面的表

const mongoose = require('mongoose')

const Schema = mongoose.Schema


//定义格式  在Schema里面
const user_schema = new Schema({
    username: String,
    age: Number,
    password: String,
    phone: String,
    email: String,
    birth: String
})

const list_schema = new Schema({
    title: String,
    id: Number,
    context: String
})

const movie_schema = new Schema({
    "genres": Array,
    "casts": Array,
    "directors": Array,
    "rating": Object,
    "title": String,
    "collect_count": Number,
    "original_title": String,
    "subtype": String,
    "year": String,
    "images": Object,
    "alt": String,
    "id": String
})

// model   数据模型  才能够操作数据库
// model   模型模具

exports.user_model = mongoose.model('users', user_schema)

exports.list_model = mongoose.model('list', list_schema)

exports.movie_model = mongoose.model('movies', movie_schema)